<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
 
 <!-- css -->
<style type="text/css">
table{
	width :750px;
	border-collapse: collapse;
}
table td{
	padding: 5px;
}
</style>
 
 <!-- script 파일 -->
 <script type="text/javascript" src="/must_go/script/jquery.js"></script>

<h1>질문과 답변</h1>

<h3>글목록</h3>

<!-- 카테고리 검색 -->
<form  action="/${initParam.rootPath }/qna/categoryList.do">
<select name="category">
	<option value="">카테고리 선택</option>
	<c:choose>
		<c:when test="${param.category =='예약' }">
				<option value="예약" selected="selected">예약</option>
		</c:when>
		<c:otherwise>
			<option value="예약">예약</option>
		</c:otherwise>
	</c:choose>
	<c:choose>
		<c:when test="${param.category =='결제' }">
				<option value="결제" selected="selected">결제</option>
		</c:when>
		<c:otherwise>
			<option value="결제">결제</option>
		</c:otherwise>
	</c:choose>
</select>
<input type="submit" value="검색" id="inline_element">
</form>

<!-- list -->
<table id="content" border="1" id="qnalist">
	<tr>
		<td width="65px" align="center">글번호</td>
		<td align="center">제목</td>
		<td width="100px" align="center">작성자</td>
		<td width="100px" align="center">작성일</td>
		<td width="60px" align="center">조회수</td>
		<td width="100" align="center">카테고리</td>
	</tr>
	<c:forEach items="${requestScope.list }" var="qnaBoard">
		<tr>
			<td>${qnaBoard.code }</td>
			<td>
				<c:forEach begin="1" end="${qnaBoard.relevel }" step="1">
					&nbsp;&nbsp;
				</c:forEach>
				<c:if test="${qnaBoard.relevel != 0 }">
					→
				</c:if>
				<a href="/${initParam.rootPath }/qna/getContent.do?code=${qnaBoard.code }&page=${requestScope.pagingBean.currentPage}">
					${qnaBoard.title }
				</a>
			</td>
			<td>${qnaBoard.name }</td>
			<td>${qnaBoard.insertDate }</td>
			<td align="right">${qnaBoard.hit }</td>
			<td>${qnaBoard.category }</td>
		</tr>
	</c:forEach>
	
</table>
<center>
<p>
<table>
	<tr>
		<td>		
		<c:choose>
			<c:when test="${requestScope.pagingBean.previousPageGroup }">
				<a href="/${initParam.rootPath }/qna/list.do?page=${requestScope.pagingBean.startPageOfPageGroup -1 }&category=${param.category}">
				◀
				</a>
			</c:when>
			<c:otherwise>
				◀
			</c:otherwise>
		</c:choose>
		<c:forEach begin="${requestScope.pagingBean.startPageOfPageGroup }"
							   end="${requestScope.pagingBean.endPageOfPageGroup }"
							   step="1"
							   var ="i">
			<c:choose>
				<c:when test="${i == requestScope.pagingBean.currentPage }">
					${i }
				</c:when>
				<c:otherwise>
					<a href="/${initParam.rootPath }/qna/list.do?page=${i }&category=${param.category}">${i }</a>
				</c:otherwise>
			</c:choose>			
		</c:forEach>
		<c:choose>
			<c:when test="${requestScope.pagingBean.nextPageGroup }">
				<a href="/${initParam.rootPath }/qna/list.do?page=${requestScope.pagingBean.endPageOfPageGroup + 1 }&category=${param.category}">
					▶
				</a>
			</c:when>
			<c:otherwise>
				▶
			</c:otherwise>
		</c:choose>
		&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
		&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
		&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
		&nbsp; 
		<!--글등록-->
		<a href="/${initParam.rootPath }/qna/write_form.do" class="menu">새글 등록</a>
		<td>
		
	</tr>
	
</table>
</center>

<!-- 검색 -->
<form  action="/${initParam.rootPath }/qna/search.do">
<select name="search">
	<option value="">선택</option>
	<option value="title">제목</option>
	<option value="name">작성자명</option>
	<option value="contents">내용</option>
</select>
<input type="text" name="keyword"></input>
<input type="submit" value="검색" id="inline_element">
</form>














